#include<iostream>
#include<cstring>
using namespace std;
const int N = 30;
int arr[N];
int main()
{
	int n, k;
	while (cin >> n) {
		memset(arr, 0, sizeof(arr));
		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}
		cin >> k;
		bool flag = 0;
		for (int i = 0; i < n; i++) {
			if (arr[i] == k && !flag) {
				flag = 1;
				continue;
			}
			cout << arr[i] << " ";
		}
		cout << endl;
	}
	return 0;
}